﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Playables.Playable
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Playables
{
  /// <summary>
  ///   <para>Playables are customizable runtime objects that can be connected together and are contained in a PlayableGraph to create complex behaviours.</para>
  /// </summary>
  [RequiredByNativeCode]
  public struct Playable : IPlayable, IEquatable<Playable>
  {
    private PlayableHandle m_Handle;
    private static readonly Playable m_NullPlayable = new Playable(PlayableHandle.Null);

    /// <summary>
    ///   <para>Returns an invalid Playable.</para>
    /// </summary>
    public static Playable Null => Playable.m_NullPlayable;

    public static Playable Create(PlayableGraph graph, int inputCount = 0)
    {
      Playable playable = new Playable(graph.CreatePlayableHandle());
      playable.SetInputCount<Playable>(inputCount);
      return playable;
    }

    [VisibleToOtherModules]
    internal Playable(PlayableHandle handle) => this.m_Handle = handle;

    public PlayableHandle GetHandle() => this.m_Handle;

    public bool IsPlayableOfType<T>() where T : struct, IPlayable
    {
      return this.GetHandle().IsPlayableOfType<T>();
    }

    public System.Type GetPlayableType() => this.GetHandle().GetPlayableType();

    public bool Equals(Playable other) => this.GetHandle() == other.GetHandle();
  }
}
